/* ******************************* *
 *       -=# Array Life #=-        *
 *             =====               *
 *         By: TarpeyD12           *
 * =============================== *
 *        Version: 0.3.5.9         *
 * ******************************* *
 *         Included file.          *
 *          array_life.h           *
 * ******************************* */
 
#ifndef _ARRAY_LIFE_H
#define _ARRAY_LIFE_H

#include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <curses.h>

#define DNASIZE		75
#define GRIDSIZEX	20 + 2
#define GRIDSIZEY	20 + 2

#define GRIDSTUFF	GRIDSIZEX, GRIDSIZEY, DNASIZE

#define RDM rand
#define SRDM srand

#define COLORIF		0	/*0=TRUE 1=FALSE*/

#define RANDDIR 	randdir = RDM(); randdir %= 9; randdir++;
#define WF_ENTER	in_tmp=getch(); while(in_tmp!='\n'){in_tmp=getch(); if(in_tmp!='\n'){printw("\b ");refresh();}}
#define WF_NTR_NOCURSE	initscr(); timeout(0); WF_ENTER endwin();
#define ELSE_DIFFCHAR	else{printw("\b ");refresh();}
#define LEFTME_F	printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
#define LEFTME_W	printw("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
#define GRIDDISPSTUFF	grid_scr, 0, 0

/* the cell states */
#define DEAD_CELL	0
#define LIVE_CELL	1
#define WALL_CELL	2
#define TEMP_CELL	3

/* Type arreibutes */
#define NORMAL		0	/* Normal display (no highlight) */
#define STANDOUT	1	/* Best highlighting mode of the terminal. */
#define UNDERLINE	2	/* Underlining */
#define REVERSE		3	/* Reverse video */
#define BLINK		4	/* Blinking */
#define DIM		5	/* Half bright */
#define BOLD		6	/* Extra bright or bold */
#define BRIGHT		6	/* Extra bright or bold */
#define PROTECT		7	/* Protected mode */
#define INVIS		8	/* Invisible or blank mode */
#define ALTCHARSET	9	/* Alternate character set */
#define CHARTEXT	10	/* Bit-mask to extract a character */

/* the color values. */
#define BLACK		0
#define RED		1
#define GREEN		2
#define YELLOW		3
#define BLUE		4
#define MAGENTA		5
#define CYAN		6
#define WHITE		7

#define defcolor(fg, bg)	init_pair(fg*10+bg, fg, bg)
#define coloron(fg, bg) 	attron(COLOR_PAIR(fg*10+bg))
#define coloroff(fg, bg)	attroff(COLOR_PAIR(fg*10+bg))

/* amino acid sequence values and DNA */

#define AA(n)		(n)

#define AAS0		000
#define AAS1		001
#define AAS2		010
#define AAS3		100
#define AAS4		011
#define AAS5		101
#define AAS6		110
#define AAS7		111

#define AAS000		0
#define AAS001		1
#define AAS010		2
#define AAS100		3
#define AAS011		4
#define AAS101		5
#define AAS110		6
#define AAS111		7

/* changing  grid values */
#define wall(x, y)	occp[x][y]=WALL_CELL;

#define SOLID		0
#define HOLLOW		1
#define LATIS		2
#define LATWALL		3

#define cell(x, y)	occp[x][y]

#define kill(x,y,dna)	kill_(x, y, dna); /*cell(x, y)=0;*/

#define quitme(n)	cls(26);refresh();exit(n);

/*int genlp_f=9999, mutate_f=1, mtf_f=1, help_f=0;
int log_f=0, see=0, seed_time=0, st_f=0, mchs_f=25, kill_f=2, kf_f=2, sbs_f, fst_f, plate_f=0;*/

/* cmd stuff */
#define GENLP		genlp_f		/* # of generations. */
#define MUTATE		mutate_f	/* # of times a cell is mutated uppon coppying. */
#define MTF		mtf_f		/* # of generations between coppying cycles. */
#define MCHS		mchs_f		/* the chance of a cell being mutated */
#define KILL		kill_f		/* # of generations between killing cycles. */
#define KF		kf_f		/* how often a cell is killed(the smaller the # the more often). */

#define GENSTUFF	/*GENLP,*/ MUTATE, MTF, MCHS, KILL, KF, spd_f, loop

#define SPD_GENSTATS	if(loop%spd_f==0 || loop==genlp_f){genstats();}
#define SPD_DISPGRID	if(loop%spd_f==0 || loop==genlp_f){disp_occp_grid(grid_scr);}

/* define the used windows */

WINDOW *grid_scr;
WINDOW *out_scr;


#define PRINTERR	wprintw(out_scr,

int m_loop;
int k_loop;

#endif /*  Ends _ARRAY_LIFE_H  */
